<template>
  <div class="red">红色,初始值:{{ count }}<button @click="add">+</button></div>
</template>
<script>
export default {
  data () {
    return {
      count: 0
    }
  },
  methods: {
    add () {
      this.count++
    }
  },
  activated () {
    console.log('Red组件被激活')
  },
  deactivated () {
    console.log('Red组件被缓存')
  }
}
</script>
<style>
.red {
  background: red;
}
</style>
